var express = require('express')
var router = express.Router();
var formidable = require('formidable');
var path = require("path");
router.post('/upload', (req, res) => {
    var form = new formidable.IncomingForm();
    form.uploadDir = path.join(__dirname + '/uploads/userImg');
    form.keepExtensions = true
    form.parse(req, function (err, fields, files) {



        res.json({ msg: '上传成功', name: files.file.name, path: files.file.path })
    })
})
router.get('/test', (req, res) => {
    res.json({ mes: 'data' })
})
module.exports = router;